import batteryInfo from '@ohos.batteryinfo';
import battery from '@system.battery';
export default {
    data: {
        title: 'World'
    },
    batteryInfo(){
        var batterySoc = batteryInfo.batterySOC;
        console.log(batterySoc)
    },
    BatteryPluggedType(){
        console.log(batteryInfo.pluggedType)
    },
    BatteryChargeState(){
        console.log(batteryInfo.chargingStatus)
    },
    BatteryHealthState(){
        console.log(batteryInfo.healthStatus)
    },
    getStatus(){
        battery.getStatus({
            success: function(data) {
                console.log('success get battery level:' + data.level);
            },
            fail: function(data, code) {
                console.log('fail to get battery level code:' + code + ', data: ' + data);
            },
        });
    }
}
